#!/bin/sh
#chkconfig: 2345 80 05
#description: wkcrm
#author: hmb
server_names=('ruoyi-gateway' 'ruoyi-auth' 'ruoyi-modules-job' 'ruoyi-modules-system' 'ruoyi-modules-file' 'ruoyi-modules-gen' 'ruoyi-modules-job' 'ruoyi-visual-monitor')
basePath=/u01/RouYi-Cloud
echo "延迟30s，等待mysql和nacos启动..."
sleep 30s
case "$1" in
start)
    cd $basePath
    for value in "${server_names[@]}"
    do
        cd $basePath/$value
        sh ./action.sh start
        sleep 10s;
    done
    echo "RouYi-Cloud startup"
    ;;
stop)
    cd $basePath
    for value in "${server_names[@]}"
    do
        sh $basePath/$value/action.sh stop;
        sleep 0.5s;
    done
    ;;
restart)
    cd $basePath
    for value in "${server_names[@]}"
    do
        sh $basePath/$value/action.sh stop;
        sleep 0.5s;
    done
    do
        cd $basePath/$value
        sh ./action.sh start
        sleep 10s;
    done
    echo "RouYi-Cloud startup"
    ;;
*)
    echo "start|stop|restart"
    ;;
esac
exit $?
